using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class AlternateCharacterSetHandlingSchemeAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public AlternateCharacterSetHandlingSchemeAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v231] = new string[]{"ISO 2022-199","<null>"};
						validVersionCodes[HL7Version.v24] = new string[]{"ISO 2022-1994","2.3","<null>"};
						validVersionCodes[HL7Version.v25] = new string[]{"ISO 2022-1994","2.3","<null>"};
						validVersionCodes[HL7Version.v251] = new string[]{"ISO 2022-1994","2.3","<null>"};
						validVersionCodes[HL7Version.v26] = new string[]{"ISO 2022-1994","2.3","<null>"};
						validVersionCodes[HL7Version.v27] = new string[]{"ISO 2022-1994","2.3","<null>"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v231] = new string[]{"This standard is titled \"Information Technology - Character Code Structure  and Extension Technique\". This standard specifies an escape sequence from basic one byte character set to specified other character set, and  vice versa.  The escape sequence expl","This is the default, indicating that there is no character set switching occurring in this message."};
						validVersionDescriptions[HL7Version.v24] = new string[]{"This standard is titled \"Information Technology - Character Code Structure and Extension Technique\". This standard specifies an escape sequence from basic one byte character set to specified other character set, and vice versa.  The escape sequence explic","The character set switching mode specified in HL7 2.3, sections 2.8.28.6.1, and 2.9.2.  Note that the escape sequences used in this mode do not use the ASCII \"esc\" character. They are \"HL7 escape sequences\" as defined in HL7 2.3, sec.  2.9 as defined in I","This is the default, indicating that there is no character set switching occurring in this message."};
						validVersionDescriptions[HL7Version.v25] = new string[]{"This standard is titled \"Information Technology - Character Code Structure and Extension Technique\". .","The character set switching mode specified in HL7 2.5, section 2.7.2, \"Escape sequences supporting multiple character sets\" and section 2.A.46, \"XPN - extended person name\".","This is the default, indicating that there is no character set switching occurring in this message."};
						validVersionDescriptions[HL7Version.v251] = new string[]{"This standard is titled \"Information Technology - Character Code Structure and Extension Technique\". .","The character set switching mode specified in HL7 2.5, section 2.7.2, âEscape sequences supporting multiple character setsâ and section 2.A.46, \"XPN - extended person name\".","This is the default, indicating that there is no character set switching occurring in this message."};
						validVersionDescriptions[HL7Version.v26] = new string[]{"This standard is titled \"Information Technology - Character Code Structure and Extension Technique\". .","The character set switching mode specified in HL7 2.5, section 2.7.2, \"Escape sequences supporting multiple character sets\" and section 2.A.46, \"XPN - extended person name\".","This is the default, indicating that there is no character set switching occurring in this message."};
						validVersionDescriptions[HL7Version.v27] = new string[]{"This standard is titled \"Information Technology - Character Code Structure and Extension Technique\". .","The character set switching mode specified in HL7 2.5, section 2.7.2 and section 2.A.46, \"XPN - extended person name\".","This is the default, indicating that there is no character set switching occurring in this message."};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
